<?php
    $item = $this->roworder;
   // echo count($item);
    /*echo "<pre>";
    print_r($item);
    echo "</pre>";*/
?>

<div class="blockcms">
    <div class="blocktitle">
        <h3 class="pink">
            Order history of  &raquo; <?=$this->username?>
        </h3>
    </div>    
    <div style="padding:10px">
        <table style=" border: 1px solid gray;">
            <tbody>
                <tr align="center" style="text-align: center; border: 1px solid gray;">
                    <td width="80px" style=" border: 1px solid gray;">
                        Invoice
                    </td>
                    <td width="170px" style=" border: 1px solid gray;">
                        City
                    </td>
                    <td width="100px" style=" border: 1px solid gray;">
                        Total
                    </td>
                    <td width="180px" style=" border: 1px solid gray;">
                        Order date
                    </td>
                    <td width="80px" style=" border: 1px solid gray;">
                        Order status
                    </td>
                </tr>
                <?php
                if(count($item) > 0)
                {
                    $status = array('Add to cart', '<span style="color:green">Check out complete</span>');
                        foreach($item as $order):
                    ?>
                <tr style=" border: 1px solid gray;">
                    
                    <td style="text-align: center;" style=" border: 1px solid gray;">
                        <a href="<?php echo BASE_URL?>/user/invoice/?id=<?=$order['order_id']?>">
                        <?=$order['order_id'] ?>
                        </a>
                    </td>
                    <td style=" border: 1px solid gray;">
                        <?=$order['City'] ?>
                    </td>
                    <td style=" border: 1px solid gray;">
                        <?=$order['total'] ?>
                    </td>
                    <td style=" border: 1px solid gray;">
                        <?=$order['date_created'] ?>
                    </td>
                    <td style="text-align: center;" style=" border: 1px solid gray;">
                        <?=@$status[$order['order_status']] ?>
                    </td>
                </tr>
                <?php
                endforeach;
                }
                ?>
            </tbody>
        </table>
    </div>
</div>